<!DOCTYPE HTML>
<html>
<head>
<title>${category.name} - ${ws.ws_name}</title>
<meta name="keywords" content="${category.name},${ws.keywords}" />
<meta name="description" content="${category.name} - ${ws.ws_name} - ${ws.description}" />
<#include "/${ws.cms_respath}/include/common.inc.ftl">
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link href="${basePath}/res/${ws.cms_respath}/css/style.css" rel="stylesheet" type="text/css" media="all" />
<script src="http://cdn.bootcss.com/jquery/2.1.3/jquery.js"></script>
<link href='http://fonts.useso.com/css?family=Roboto+Condensed:100,200,300,400,500,600,700,800,900' rel='stylesheet' type='text/css'>
<script type="text/javascript">
	function setTag(e) {
		$("#tags .btn-primary").addClass("btn-default").removeClass("btn-primary");
		$(e).addClass("btn-primary");
		toUrl();
	}
	
	function setPage(e) {
		$("#tags .btn-primary").addClass("btn-default").removeClass("btn-primary");
		$(e).addClass("btn-primary");
		toUrl();
	}

	function setYear(e) {
		$("#years .btn-primary").addClass("btn-default").removeClass("btn-primary");
		$(e).addClass("btn-primary");
		toUrl();
	}

	function setArea(e) {
		$("#areas .btn-primary").addClass("btn-default").removeClass("btn-primary");
		$(e).addClass("btn-primary");
		toUrl();
	}

	function toUrl() {
		var tag = $("#tags .btn-primary").val();
		var year = $("#years .btn-primary").val();
		var area = $("#areas .btn-primary").val();
		var u = "${basePath}/g/${category.code}?";
		if (tag != undefined && tag != "") {
			u = u + "&tag=" + tag;
		}
		if (year != undefined && year != "") {
			u = u + "&year=" + year;
		}
		if (area != undefined && area != "") {
			u = u + "&area=" + area;
		}
		window.location.href = u;
	}
	
	function search() {
		var title = $("#title").val();
		var u = "${basePath}/g/${category.code}?title=" + title;
		window.location.href = u;
	}
</script>
</head>
<body>
	<div class="container" style="width: 1000px !important;">
		<div class="container_wrap">
			<#include "/${ws.cms_respath}/include/common.head.ftl">
			<div class="content">
				<h2 class="m_3">
					${category.name} <small>${category.memo}</small>
				</h2>
				<div class="movie_top">
					<div class="col-xs-9 movie_box">
						<@cms_movie_page tag=param['tag'] year=param['year'] area=param['area'] title=param['title'] cgid=category.id page=pagecount rows=20 ord='year' ordtype='desc'> 
						<div class="row bs-examples">
							<div class="col-xs-12" style="padding-bottom: 10px;">
								<dl class="dl-horizontal" style="margin-bottom: 8px;">
									<dt style="width: 40px;">类型 </dt>
									<dd style="margin-left: 60px;">
										<div id="tags" class="btn-group btn-group-xs" role="group">
											<button type="button" class="btn <#if param['tag']&&param['tag']!=''>btn-default<#else>btn-primary</#if>" onclick="setTag(this)" value="">全部</button>
											<@cms_tag_list rows=15> <#list tags as item>
											<button type="button" class="btn <#if item.name == param['tag']>btn-primary<#else>btn-default</#if>" onclick="setTag(this)"
												value="${item.name}">${item.name}</button>
											</#list> </@cms_tag_list>
										</div>
									</dd>
								</dl>
								<dl class="dl-horizontal" style="margin-bottom: 8px;">
									<dt style="width: 40px;">地区 </dt>
									<dd style="margin-left: 60px;">
										<div id="areas" class="btn-group btn-group-xs" role="group">
											<button type="button" class="btn <#if param['area']&&param['area']!=''>btn-default<#else>btn-primary</#if>" onclick="setTag(this)" value="">全部</button>
											<#list areas as item>
											<button type="button" class="btn <#if item == param['area']>btn-primary<#else>btn-default</#if>" onclick="setArea(this)" value="${item}">${item}</button>
											</#list>
										</div>
									</dd>
								</dl>
								<dl class="dl-horizontal" style="margin-bottom: 8px;">
									<dt style="width: 40px;">年代</dt>
									<dd style="margin-left: 60px;">
										<div id="years" class="btn-group btn-group-xs" role="group">
											<button type="button" class="btn <#if param['year']&&param['year']!=''>btn-default<#else>btn-primary</#if>" onclick="setYear(this)"
												value="">全部</button>
											<#list 2015..2005 as t>
											<button type="button" class="btn <#if t == param['year']>btn-primary<#else>btn-default</#if>" onclick="setYear(this)" value="${t}">${t}</button>
											</#list>
										</div>
									</dd>
								</dl>
							</div>
							<#assign tempc = 1>
							<#assign tempb = 1>
							<#list page.data as item >
							<#if tempc==1><div class="row"></#if>
							<div class="col-xs-3" >
								<div class="thumbnail">
									<a href="${basePath}/a/${item.id}" target="_blank"><img src="<#if item.img && item.img !='' && item.img !='error'>${item.img}<#else>${basePath}/res/${ws.cms_respath}/poster.jpg</#if>" alt="${item.title}" /></a>
									<div class="caption text-center" style="font-size:12px">
										<div class="title">
											<a href="${basePath}/a/${item.id}" target="_blank">《${item.title}》</a>
										</div>
									</div>
								</div>
							</div>
							<#if tempc==4 || page.data?size==tempb></div><#assign tempc = 1><#else><#assign tempc = tempc + 1></#if>
							<#assign tempb = tempb + 1>
							</#list>
						</div>
						<div class="row">
							<nav class="col-xs-12">
								<ul class="pagination">
									<#if pagecount &gt; 1>
									<#assign temppage = pagecount - 1>
									<li><a href="${basePath}/g/${category.code}_${temppage}?tag=${param['tag']}&year=${param['year']}" page="${temppage}" aria-label="Previous"> <span aria-hidden="true">&laquo;</span></a></li>
									</#if>
									<#if 4 &lt; pagecount>
									<li><a href="${basePath}/g/${category.code}_1?tag=${param['tag']}&year=${param['year']}" aria-label="Next"> <span aria-hidden="true">1</span></a></li>
									<#if pagecount&gt;5><li><a>...</a></li></#if>
									</#if>
									<#list -3..3 as c>
									<#assign temppage = pagecount + c>
									<#if temppage&gt;=1 && page.maxPage &gt;= temppage>
									<li <#if pagecount==temppage>class="active"</#if>>
										<a <#if pagecount !=temppage> href="${basePath}/g/${category.code}_${temppage}?tag=${param['tag']}&year=${param['year']}"</#if>>${temppage}</a></li> 
									</#if>
									</#list>
									<#if temppage &lt; page.maxPage>
									<#if temppage+1 !=page.maxPage><li><a>...</a></li></#if>
									<li><a href="${basePath}/g/${category.code}_${page.maxPage}?tag=${param['tag']}&year=${param['year']}" aria-label="Next"> <span aria-hidden="true">${page.maxPage}</span></a></li>
									</#if>
									
									<#if pagecount &lt; page.maxPage>
									<#assign temppage = pagecount + 1>
									<li><a href="${basePath}/g/${category.code}_${temppage}?tag=${param['tag']}&year=${param['year']}" aria-label="Next"> <span aria-hidden="true">&raquo;</span></a></li>
									</#if>
									<li><a>总共：${page.total}条</a></li>
								</ul>
							</nav>
						</div>
						</@cms_movie_page>
					</div>
					<div class="col-xs-3">
						<div class="row">
							<div class="col-xs-12 form-inline" style="padding-bottom: 10px;">
								<div class="input-group">
									<input id="title" type="text" class="form-control" placeholder="影片名称"> <span class="input-group-btn" />
									<button class="btn btn-default" type="button" onclick="search()">Go!</button>
									</span>
								</div>
							</div>
						</div>
					</div>
					<div class="clearfix"></div>
				</div>
				<h1 class="recent">
					Recently Viewed
					</h1>
					<ul id="flexiselDemo3">
						<@cms_movie_page  page=1 rows=10 ord='score' ordtype='desc'><#list page.data as item >
						<li><img style="width: 170px;" src="<#if item.img && item.img !=''>${item.img}<#else>${basePath}/res/${ws.cms_respath}/poster.jpg</#if>" class="img-responsive" />
							<div class="grid-flex">
								<a href="${basePath}/a/${item.id}" target="_blank">${item.title}${item.score}</a>
								<!-- <p>22.10.2014 | 14:40</p> -->
							</div></li>
						</#list></@cms_movie_page>
					</ul>
					<script type="text/javascript">
						$(window).load(function() {
							$("#flexiselDemo3").flexisel({
								visibleItems : 5,
								animationSpeed : 1000,
								autoPlay : true,
								autoPlaySpeed : 3000,
								pauseOnHover : true,
								enableResponsiveBreakpoints : true,
								responsiveBreakpoints : {
									portrait : {
										changePoint : 480,
										visibleItems : 1
									},
									landscape : {
										changePoint : 640,
										visibleItems : 2
									},
									tablet : {
										changePoint : 768,
										visibleItems : 3
									}
								}
							});

						});
					</script>
					<script type="text/javascript" src="${basePath}/res/${ws.cms_respath}/js/jquery.flexisel.js"></script>
			</div>
		</div>
		<#include "/${ws.cms_respath}/include/common.foot.ftl">
	</div>
</body>
</html>